<?php
class NavigateController extends ManagerController {
	public function NavigateController(){
		parent::ManagerController();
	}
	
	public function index(){
		$this->init_page_info();
		$condition = array('site_id'=>SITE_ID);
		$mod = new NavigateModel();
		$total = $mod->count($condition);
		$this->set_page_total($total);
		$ads = $mod->find($condition, null, $this->page_info->get_start(), $this->page_info->page_size);
		$this->assign('navigates', $ads);
		$this->display();
	}
	
	public function edit(){
		if(IS_POST){
			$this->save();
		}
		$this->display();
	}
	

	private function save(){
		$h = new FormHelper(array(
				'name' => 'navigate_form',
				'add_site_id' => true,
		));
		$result = $h->save();
		$this->ajax_info($result);
	}
	
	public function del(){
		$mod = new NavigateModel();
		$mod->delete_by_key_site_limit($this->id);
		self::ajax_info('删除成功！');
	}
}

?>